package com.cuit.mimall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cuit.mimall.entity.SeckillTime;
import com.cuit.mimall.mapper.SeckillTimeMapper;
import com.cuit.mimall.service.ISeckillTimeService;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.Date;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author TeaWu
 * @since 2023-07-04
 */
@Service
public class SeckillTimeServiceImpl extends ServiceImpl<SeckillTimeMapper, SeckillTime> implements ISeckillTimeService {

    private Date getDate() {
        Calendar ca = Calendar.getInstance();
        ca.set(Calendar.MINUTE, 0);
        ca.set(Calendar.SECOND, 0);
        return ca.getTime();
    }

    /**
     *
     */
    @Override
    public void deleteAll() {

    }

    /**
     * @return Object
     */
    @Override
    public Object getSeckillTime() {
        Date time = getDate();
        return baseMapper.getSkillTime(time.getTime() / 1000 * 1000);
    }
}
